#ifndef SHELL_HPP_
#define SHELL_HPP_

#if TRACE_SHELL
#define SHELL_TRACE(x ...) TRACE("Shell: " x)
#else
#define SHELL_TRACE(x ...)
#endif

class CThread;

class CShell
{
public:
	void Initialize( ITextInput * input, ITextOutput * output );
	void Shutdown( void );
	void Start( void );

private:
	static int __Run( void * );
	int _Run( void );
	void _ReadCommand( void );
	void _ProcessCommand( void );

private:
	enum
	{
		SHELL_BUFFER_LENGTH	= 256,
	};

	ITextInput * fInput;
	ITextOutput * fOutput;
	char fBuffer[SHELL_BUFFER_LENGTH];
	Size fPosition;
	bool fRunning;
	CThread * fThread;
};

extern CShell * Shell;

#endif /*SHELL_HPP_*/
